package com.hspedu.springcloud.service;

import com.hspedu.springcloud.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author 韩顺平
 * @version 1.0
 */
@FeignClient(value = "seata-storage-micro-service")
public interface StorageService {

    /**
     * 老师解读
     * 1. 远程调用方式是 post
     * 2. 远程调用的url 为 http://seata_storage_micro_service/storage/reduce
     * 3. seata_storage_micro_service是nacos注册中心服务名
     * 4. openfeign是通过接口方式调用服务
     */
    //扣减库存
    @PostMapping("/storage/reduce")
    public Result reduce(@RequestParam("productId") Long productId,@RequestParam("nums") Integer nums);
}
